import requests

# 添加员工
url_add = "http://ihrm-test.itheima.net/api/sys/user"
headers_add = {"Content-Type": "application/json", "Authorization": "Bearer 044cebb4-bbcd-43f3-ab22-4f69ac12a8d9"}
add_data = {"username": "小猪哈哈01", "mobile": "13904965662", "workNumber": "3985"}
resp_add = requests.post(url=url_add, headers=headers_add, json=add_data)
print("添加员工：", resp_add.json())

# 查询员工
url_search = "http://ihrm-test.itheima.net/api/sys/user/1528293749673754624"
headers_search = {"Content-Type": "application/json", "Authorization": "Bearer 044cebb4-bbcd-43f3-ab22-4f69ac12a8d9"}
resp_search = requests.get(url=url_search, headers=headers_search)
print("查询员工：", resp_search.json())

# 修改员工
url_update = "http://ihrm-test.itheima.net/api/sys/user/1528293749673754624"
headers_update = {"Content-Type": "application/json", "Authorization": "Bearer 044cebb4-bbcd-43f3-ab22-4f69ac12a8d9"}
update_data = {"username": "小猪哈哈02"}
resp_update = requests.put(url=url_update, headers=headers_update, json=update_data)
print("修改员工：", resp_update.json())

# 删除员工
url_delete = "http://ihrm-test.itheima.net/api/sys/user/1528293749673754624"
headers_delete = {"Content-Type": "application/json", "Authorization": "Bearer 044cebb4-bbcd-43f3-ab22-4f69ac12a8d9"}
resp_delete = requests.delete(url=url_delete, headers= headers_delete)
print("删除员工：", resp_delete.json())
